package com.jblog.core.model.blog;

import com.jblog.core.model.BaseModel;
import com.jblog.core.model.common.Status;

/**
 * Tag.java
 */
public class Tag extends BaseModel {

	private static final long serialVersionUID = 1L;

	private String name;
	private String alias;
	private Status status;
	private Long posts;

    public Tag() {
        super();
    }

    public Tag(Long id) {
        super(id);
    }

    public Tag(String alias) {
        super();
        this.alias = alias;
    }

    public Tag(Long id, Status status) {
        super(id);
        this.status = status;
    }

    public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public Status getStatus() {
		return status;
	}

    public Long getPosts() {
        return posts;
    }

    public void setPosts(Long posts) {
        this.posts = posts;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "Tag [name=" + name + ", alias=" + alias + ", id=" + getId() + "]";
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((alias == null) ? 0 : alias.hashCode());
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Tag other = (Tag) obj;
        if (alias == null) {
            if (other.alias != null)
                return false;
        } else if (!alias.equals(other.alias))
            return false;
        if (name == null) {
            if (other.name != null)
                return false;
        } else if (!name.equals(other.name))
            return false;
        if (getId() == null) {
            if (other.getId() != null)
                return false;
        } else if (!getId().equals(other.getId()))
            return false;
        return true;
    }

}
